Description:
Avoid using statement labels at the same level as case labels.
A case label with the case keyword mistakenly deleted becomes
a statement label, and the compiler is not able to detect the problem.
Incorrect:
switch (kind) {
case POINT:
return "Point";
LINE:
return "Line";
case POLYGON:
loop:
for (int i = 0; i < numVertexes(); i++) {
...
}
...
Default:
return "n/a";
}
Correct:
switch (kind) {
case POINT:
return "Point";
case LINE:
return "Line";
case POLYGON: {
loop:
for (int i = 0; i < numVertexes(); i++) {
...
}
...
}
default:
return "n/a";
}